<template>
	<view>
		<view class="group-fac u-flex u-row-between u-col-center" v-for="(item,index) in projectData" :key="index" @click="jump('/pages/index/project_list/detail',{id:item.id})">
			<image class="left-img" :src="item.project.image"></image>
			<view style="width: 80%;">
				<view class="leftgroup u-flex u-row-between u-col-center">
					<view class="left-project">{{ item.project.project_name }}</view>
					<view class="u-flex u-row-right u-col-center">
<!--						<u-icon name="star" class="right" color="#999999" size="30"></u-icon>-->
						<u-icon name="star-fill" class="right" color="#E9841F" size="34"></u-icon>
						<view class="num">{{item.fav_num}}</view>
					</view>
				
				</view>
				<view class="left-title u-ellipsis-2" v-html="item.project.project_desc"></view>
			</view>
		</view>
		<u-loadmore :status="loadingType" margin-top="20"></u-loadmore>
	</view>
</template>

<script>
export default {
	data() {
		return {
			page: 1, //分页加载
			loadingType: 'more', //加载更多状态
			projectData:[]
		};
	},
	onLoad(){
		console.log("====123")
		this.getMyproject("refresh")
	},
	methods:{
		jump(path, parmas) {
			this.$Router.push({
				path: path,
				query: parmas
			});
		},
		getMyproject(type = 'add', loading) {
			if (type === 'add') {
				if (this.loadingType === 'nomore') {
					return;
				}
				this.loadingType = 'loading';
			} else if (type === 'refresh') {
				this.loadingType = 'loading';
				this.page = 1;
				this.projectData = [];
			} else {
				this.loadingType = 'more';
			}
			
			let formData = {
				page: this.page,
				token: uni.getStorageSync('token')
			};
			this.$new_http('newuser.favproject', formData).then(res => {
				let projectList = res.data.data;
				this.page++;
				this.projectData = this.projectData.concat(projectList);
				this.loadingType = res.data.current_page >= res.data.last_page ? 'nomore' : 'more';
			});
		}
		
	},
	//加载更多
	onReachBottom() {
		this.getMyproject();
	}
	
}
</script>

<style lang="scss">
page{
	background: #F7F7F7;
}
.group-fac{
	background: #fff;
	border-bottom:2rpx solid #F0F0F0 ;
	margin: 20rpx 30rpx 0;
	padding: 30rpx 20rpx;
	border-radius: 18rpx;
	width: 93%;
	.left-img{
		width: 260rpx;
		height: 160rpx;
		margin-right: 20rpx;
	}
	.leftgroup{
		font-weight: bold;
		color: #000000;
		line-height: 30rpx;
		.right{
			width:20rpx;
			height: 30rpx;
		}
	}
	.left-title{
		margin-top: 20rpx;
		font-weight: 500;
		font-size: 26rpx;
		color: #666666;
		line-height: 42rpx;
	}
	.num{
		font-size: 24rpx;
		color:#ED861F;
		margin-left: 18rpx;
	}
}
</style>
